<?php

if(!defined('IN_SYS')) exit('Access Denied');

class upload_controller extends controller{

	public function __construct(){
		parent::__construct();
	}

	public function  uploadimage(){
		
		$config = array(
			"filename" => "",
			"pathFormat" => "/uploads/{yyyy}{mm}/{dd}/{time}{rand:6}",
			"maxSize" => 2048000,
			"allowFiles" => array( ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".zip", ".rar", ".doc", ".docx", '.xls' ),
			);
		if (!empty($_FILES['upfile']['name'])) {
			$up = new uploader('upfile', $config, 'upload');
		} else {
			$up = new uploader('file', $config, 'upload');
		}
		echo json_encode($up->getFileInfo());
	}

	public function  swfupfile(){
		$config = array(
			"pathFormat" => "/uploads/{yyyy}{mm}/{dd}/{time}{rand:6}",
			"maxSize" => 2048000,
			"allowFiles" => array( ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".zip", ".rar", ".doc", ".docx", '.xls' ),
			);
		$up = new uploader('Filedata', $config, 'upload');
		//echo json_encode($up->getFileInfo());
		$data = $up->getFileInfo();
		echo $data['url'];
	}
}
